package com.example.demo;

import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-07-16
 * Time: 10:27
 */
@Controller
public class UserController {



    @Value("${mystring}") // 读取配置文件
    private String mystring; // 接收配置文件

    @Value("${mystring1}")
    private String mystring1;

    @Value("${mystring2}")
    private String mystring2;


    @Autowired
    private Student student; // 属性注入
    @ResponseBody // 返回一个非静态页面的数据
    @RequestMapping("/sayhi") // 设置路由地址


    public String sayHi() {
        // 打印配置文件
//        System.out.println("mystring:" + mystring);
//        System.out.println("mystring1:" + mystring1);
//        System.out.println("mystring2:" + mystring2);
        return "student" + student;
    }


}
